\hypertarget{class_sound_engine}{
\section{SoundEngine Class Reference}
\label{class_sound_engine}\index{SoundEngine@{SoundEngine}}
}


The \hyperlink{class_sound_engine}{SoundEngine} class plays the game sound effects by using the preferred sound engine implementation.  


\subsection*{Public Slots}
\begin{DoxyCompactItemize}
\item 
void \hyperlink{class_sound_engine_ac20b6d80d78f0e732e05a80f0423d169}{setVolumeLevel} (int volumeLevel)
\begin{DoxyCompactList}\small\item\em Sets the volume level given at the attribute {\itshape volumeLevel\/}. \item\end{DoxyCompactList}\item 
void \hyperlink{class_sound_engine_a23ed19f5d1815ef56c1791a092a85f95}{play} (\hyperlink{soundengine_8h_a608db89860fa5723001cc530622ba5bf}{SoundEffectType})
\begin{DoxyCompactList}\small\item\em Plays the sound effect given at the attribute {\itshape soundEffect\/}. \item\end{DoxyCompactList}\item 
Q\_\-INVOKABLE void \hyperlink{class_sound_engine_aa31e1b6644168a4577e1eb2a292d2bf6}{playMenuSound} ()
\begin{DoxyCompactList}\small\item\em Plays the SoundEffectType::SoundMenu sound effect. \item\end{DoxyCompactList}\end{DoxyCompactItemize}
\subsection*{Public Member Functions}
\begin{DoxyCompactItemize}
\item 
\hyperlink{class_sound_engine_a2253b41298fb1e82ed7b8afc7969e1d6}{SoundEngine} (int volumeLevel, QObject $\ast$parent=0)
\begin{DoxyCompactList}\small\item\em Constructs an \hyperlink{class_sound_engine}{SoundEngine}. \item\end{DoxyCompactList}\item 
\hypertarget{class_sound_engine_a4f5112b970cd03683bde0250d5a7d279}{
\hyperlink{class_sound_engine_a4f5112b970cd03683bde0250d5a7d279}{$\sim$SoundEngine} ()}
\label{class_sound_engine_a4f5112b970cd03683bde0250d5a7d279}

\begin{DoxyCompactList}\small\item\em Destructs the \hyperlink{class_sound_engine}{SoundEngine}. \item\end{DoxyCompactList}\item 
\hyperlink{class_sound_effect}{SoundEffect} $\ast$ \hyperlink{class_sound_engine_a3d84d529494f068d52fba509ae427fa4}{createSoundEffect} (\hyperlink{soundengine_8h_a608db89860fa5723001cc530622ba5bf}{SoundEffectType}, int frame, FPtype timeStamp)
\begin{DoxyCompactList}\small\item\em Creates new \hyperlink{class_sound_effect}{SoundEffect} that plays the type of sound effect given at the attribute {\itshape type\/}. \item\end{DoxyCompactList}\end{DoxyCompactItemize}
\subsection*{Private Member Functions}
\begin{DoxyCompactItemize}
\item 
\hypertarget{class_sound_engine_af0d71ffcfc0d7af7767b0c73358bca12}{
void \hyperlink{class_sound_engine_af0d71ffcfc0d7af7767b0c73358bca12}{loadFile} (\hyperlink{soundengine_8h_a608db89860fa5723001cc530622ba5bf}{SoundEffectType} effectType, const QString \&fileName)}
\label{class_sound_engine_af0d71ffcfc0d7af7767b0c73358bca12}

\begin{DoxyCompactList}\small\item\em Loads WAV sound file {\itshape fileName\/} of given {\itshape effectType\/} to the data buffer. \item\end{DoxyCompactList}\item 
QByteArray $\ast$ \hyperlink{class_sound_engine_a778a8cc9f38cd3bc1c8df56a68e300b7}{initialize} (QFile \&file, \hyperlink{class_wav_file}{WavFile} \&wavFile, \hyperlink{soundengine_8h_a608db89860fa5723001cc530622ba5bf}{SoundEffectType} effectType)
\begin{DoxyCompactList}\small\item\em Initializes sound engine with WAV sound file. \item\end{DoxyCompactList}\item 
\hypertarget{class_sound_engine_ae654aabce748b6f6dc1ebf08d7514c35}{
QString \hyperlink{class_sound_engine_ae654aabce748b6f6dc1ebf08d7514c35}{formatToString} (const QAudioFormat \&format)}
\label{class_sound_engine_ae654aabce748b6f6dc1ebf08d7514c35}

\begin{DoxyCompactList}\small\item\em Convets audio format to QString. \item\end{DoxyCompactList}\end{DoxyCompactItemize}


\subsection{Detailed Description}
The \hyperlink{class_sound_engine}{SoundEngine} class plays the game sound effects by using the preferred sound engine implementation. The \hyperlink{class_sound_engine}{SoundEngine} class is used to play the game sound effects. \hyperlink{class_sound_engine}{SoundEngine} is a generic class without the actual playback implementation. \hyperlink{class_sound_engine}{SoundEngine} loads WAV soundfiles and instantiatates the sound engine that is responsible for the playback.

\begin{DoxyParagraph}{Tutorials}

\end{DoxyParagraph}
\hyperlink{replacing_sound_effect}{Replacing the Game Sound Effect}

\hyperlink{add_new_sound_effect}{Adding New Sound Effect to Game Event}

\begin{DoxySeeAlso}{See also}
\hyperlink{class_game_engine}{GameEngine} \hyperlink{class_sound_engine_pulse_audio}{SoundEnginePulseAudio} \hyperlink{class_sound_engine_q_audio}{SoundEngineQAudio} 
\end{DoxySeeAlso}


\subsection{Constructor \& Destructor Documentation}
\hypertarget{class_sound_engine_a2253b41298fb1e82ed7b8afc7969e1d6}{
\index{SoundEngine@{SoundEngine}!SoundEngine@{SoundEngine}}
\index{SoundEngine@{SoundEngine}!SoundEngine@{SoundEngine}}
\subsubsection[{SoundEngine}]{\setlength{\rightskip}{0pt plus 5cm}SoundEngine::SoundEngine (
\begin{DoxyParamCaption}
\item[{int}]{ volumeLevel, }
\item[{QObject $\ast$}]{ parent = {\ttfamily 0}}
\end{DoxyParamCaption}
)\hspace{0.3cm}{\ttfamily  \mbox{[}explicit\mbox{]}}}}
\label{class_sound_engine_a2253b41298fb1e82ed7b8afc7969e1d6}


Constructs an \hyperlink{class_sound_engine}{SoundEngine}. 

Instatiates QAudio ar PulseAudio engine and loads WAV sound files. Attribute {\itshape volumeLevel\/} sets the initial volume from 0-\/10. 

\subsection{Member Function Documentation}
\hypertarget{class_sound_engine_a3d84d529494f068d52fba509ae427fa4}{
\index{SoundEngine@{SoundEngine}!createSoundEffect@{createSoundEffect}}
\index{createSoundEffect@{createSoundEffect}!SoundEngine@{SoundEngine}}
\subsubsection[{createSoundEffect}]{\setlength{\rightskip}{0pt plus 5cm}{\bf SoundEffect} $\ast$ SoundEngine::createSoundEffect (
\begin{DoxyParamCaption}
\item[{{\bf SoundEffectType}}]{ type, }
\item[{int}]{ frame, }
\item[{FPtype}]{ timeStamp}
\end{DoxyParamCaption}
)}}
\label{class_sound_engine_a3d84d529494f068d52fba509ae427fa4}


Creates new \hyperlink{class_sound_effect}{SoundEffect} that plays the type of sound effect given at the attribute {\itshape type\/}. 

The new effect stores current {\itshape frame\/} and {\itshape timeStamp\/}. Returns \begin{DoxyReturn}{Returns}
\hyperlink{class_sound_effect}{SoundEffect}. The ownership is transferred. 
\end{DoxyReturn}
\begin{DoxySeeAlso}{See also}
\hyperlink{soundengine_8h_a608db89860fa5723001cc530622ba5bf}{SoundEffectType}. 
\end{DoxySeeAlso}
\hypertarget{class_sound_engine_a778a8cc9f38cd3bc1c8df56a68e300b7}{
\index{SoundEngine@{SoundEngine}!initialize@{initialize}}
\index{initialize@{initialize}!SoundEngine@{SoundEngine}}
\subsubsection[{initialize}]{\setlength{\rightskip}{0pt plus 5cm}QByteArray $\ast$ SoundEngine::initialize (
\begin{DoxyParamCaption}
\item[{QFile \&}]{ file, }
\item[{{\bf WavFile} \&}]{ wavFile, }
\item[{{\bf SoundEffectType}}]{ effectType}
\end{DoxyParamCaption}
)\hspace{0.3cm}{\ttfamily  \mbox{[}private\mbox{]}}}}
\label{class_sound_engine_a778a8cc9f38cd3bc1c8df56a68e300b7}


Initializes sound engine with WAV sound file. 

Reads audio data and audio format and sets them to sound engine. \hypertarget{class_sound_engine_a23ed19f5d1815ef56c1791a092a85f95}{
\index{SoundEngine@{SoundEngine}!play@{play}}
\index{play@{play}!SoundEngine@{SoundEngine}}
\subsubsection[{play}]{\setlength{\rightskip}{0pt plus 5cm}void SoundEngine::play (
\begin{DoxyParamCaption}
\item[{{\bf SoundEffectType}}]{ soundEffect}
\end{DoxyParamCaption}
)\hspace{0.3cm}{\ttfamily  \mbox{[}slot\mbox{]}}}}
\label{class_sound_engine_a23ed19f5d1815ef56c1791a092a85f95}


Plays the sound effect given at the attribute {\itshape soundEffect\/}. 

\begin{DoxySeeAlso}{See also}
\hyperlink{soundengine_8h_a608db89860fa5723001cc530622ba5bf}{SoundEffectType}. 
\end{DoxySeeAlso}
\hypertarget{class_sound_engine_aa31e1b6644168a4577e1eb2a292d2bf6}{
\index{SoundEngine@{SoundEngine}!playMenuSound@{playMenuSound}}
\index{playMenuSound@{playMenuSound}!SoundEngine@{SoundEngine}}
\subsubsection[{playMenuSound}]{\setlength{\rightskip}{0pt plus 5cm}void SoundEngine::playMenuSound (
\begin{DoxyParamCaption}
{}
\end{DoxyParamCaption}
)\hspace{0.3cm}{\ttfamily  \mbox{[}slot\mbox{]}}}}
\label{class_sound_engine_aa31e1b6644168a4577e1eb2a292d2bf6}


Plays the SoundEffectType::SoundMenu sound effect. 

\begin{DoxySeeAlso}{See also}
\hyperlink{soundengine_8h_a608db89860fa5723001cc530622ba5bf}{SoundEffectType}. 
\end{DoxySeeAlso}
\hypertarget{class_sound_engine_ac20b6d80d78f0e732e05a80f0423d169}{
\index{SoundEngine@{SoundEngine}!setVolumeLevel@{setVolumeLevel}}
\index{setVolumeLevel@{setVolumeLevel}!SoundEngine@{SoundEngine}}
\subsubsection[{setVolumeLevel}]{\setlength{\rightskip}{0pt plus 5cm}void SoundEngine::setVolumeLevel (
\begin{DoxyParamCaption}
\item[{int}]{ volumeLevel}
\end{DoxyParamCaption}
)\hspace{0.3cm}{\ttfamily  \mbox{[}slot\mbox{]}}}}
\label{class_sound_engine_ac20b6d80d78f0e732e05a80f0423d169}


Sets the volume level given at the attribute {\itshape volumeLevel\/}. 

The {\itshape volumeLevel\/} can be between 0-\/10. 

The documentation for this class was generated from the following files:\begin{DoxyCompactItemize}
\item 
\hyperlink{soundengine_8h}{soundengine.h}\item 
soundengine.cpp\end{DoxyCompactItemize}
